﻿@{
    Layout = null;
}
@model System.Collections.IEnumerable
<!DOCTYPE html>
@Html.Partial("LoadPanelPartial")
<html>
<head>
     @if (false)
    {
        <script src="../../../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
    }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />

    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/FloatDiv.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>
    
    @Html.DevExpress().GetStyleSheets(
                new StyleSheet { ExtensionType = ExtensionType.GridView, Theme = DevExpressHelper.Theme }

    )
    @Html.DevExpress().GetScripts(
                    new Script { ExtensionType = ExtensionType.ListBox }
    )

    <script type="text/javascript">

        $(function () {
            $("#toolMenu").smartFloat();

            ASPxClientTextBox.Cast("yyyy").SetText($("#hidyyyy").val());
            ASPxClientTextBox.Cast("mm").SetText($('#hidmm').val());
            ASPxClientTextBox.Cast("nsr").SetText($('#hidnsr').val());
            ASPxClientTextBox.Cast("sfz").SetText($('#hidsfz').val());
            ASPxClientTextBox.Cast("btbl").SetText($('#hidbtbl').val());
            ASPxClientComboBox.Cast("khyh").SetValue($('#hidkhyh').val());
            ASPxClientTextBox.Cast("btrq").SetText($('#hidbtrq').val());

            $('input[name=yyyy]').keydown(function () {
                var k = window.event.keyCode;

                if ((k == 161) || (k == 46) || (k == 8) || (k == 190) || (k == 110) || (k >= 48 && k <= 57) || (k >= 96 && k <= 105) || (k >= 37 && k <= 40)) {
                    if (k == 110 || k == 190) {

                        if ($(this).val().length == 0 || $(this).val().indexOf(".") != -1) {

                            window.event.returnValue = false;
                        }
                    }
                    if (k == 161) {
                        window.event.keyCode = 64;
                    }
                }
                else if (k == 13) {
                    window.event.keyCode = 9;
                }
                else {
                    window.event.returnValue = false;
                }
            });


            $('input[name=mm]').keydown(function () {
                var k = window.event.keyCode;

                if ((k == 161) || (k == 46) || (k == 8) || (k == 190) || (k == 110) || (k >= 48 && k <= 57) || (k >= 96 && k <= 105) || (k >= 37 && k <= 40)) {
                    if (k == 110 || k == 190) {

                        if ($(this).val().length == 0 || $(this).val().indexOf(".") != -1) {

                            window.event.returnValue = false;
                        }
                    }
                    if (k == 161) {
                        window.event.keyCode = 64;
                    }
                }
                else if (k == 13) {
                    window.event.keyCode = 9;
                }
                else {
                    window.event.returnValue = false;
                }
            });

            $('input[name=btbl]').keydown(function () {
                var k = window.event.keyCode;
                if ((k == 161) || (k == 46) || (k == 8) || (k == 190) || (k == 110) || (k >= 48 && k <= 57) || (k >= 96 && k <= 105) || (k >= 37 && k <= 40)) {
                    if (k == 110 || k == 190) {

                        if ($(this).val().length == 0 || $(this).val().indexOf(".") != -1) {

                            window.event.returnValue = false;
                        }
                    }
                    if (k == 161) {
                        window.event.keyCode = 64;
                    }
                }
                else if (k == 13) {
                    window.event.keyCode = 9;
                }
                else {
                    window.event.returnValue = false;
                }


            });


        });

        function OnBeginCallback(s, e) {
            e.customArgs["command"] = e.command;
            e.customArgs["pageIndex"] = s.pageIndex;
            e.customArgs["pageCount"] = s.pageCount;
            e.customArgs["pageRowSize"] = s.pageRowSize;
            e.customArgs["pageRowCount"] = s.pageRowCount;
            e.customArgs["adNo"] = $('#hidAdNo').val();

            e.customArgs["yyyy"] = $('#hidyyyy').val();
            e.customArgs["mm"] = $('#hidmm').val();
            e.customArgs["nsr"] = $('#hidnsr').val();
            e.customArgs["sfz"] = $('#hidsfz').val();
            e.customArgs["btbl"] = $('#hidbtbl').val();
            e.customArgs["khyh"] = $('#hidkhyh').val();
            e.customArgs["btrq"] = $('#hidbtrq').val();
        }

        function fwmmszbtzAdd() {
            var rs = window.showModalDialog(rootPath + "/Admin/Fwmmszbtz/FwmmszbtzContent", 'fwmmszbtzAdd', 'dialogWidth:650px;dialogHeight:700px');
            if (typeof (rs) != "undefined") {
                window.location.href = rootPath + "/Admin/Fwmmszbtz/FwmmszbtzList";
            }
        }

        function MenuTop_emClick(source, e) {
            switch (e.item.name) {
                case "btnAdd":
                    {
                        //增加
                        fwmmszbtzAdd();
                        break;
                    }
                case "btnDelete":
                    {
                        //删除
                        fwmmszbtzManyDel();
                        break;
                    }
                case "btnPrint":
                    {
                        //打印
                        window.location.href = rootPath + "/Admin/Print/Index?yyyy="
                        + $("#hidyyyy").val() + "&mm=" + $("#hidmm").val() + "&nsr=" + $("#hidnsr").val() + "&sfz="
                        + $("#hidsfz").val() + "&btbl=" + $("#hidbtbl").val() + "&khyh=" + $("#hidkhyh").val() + "&btrq=" + $("#hidbtrq").val()
//                        + yyyy.GetText() + "&mm=" + mm.GetText() + "&nsr=" + nsr.GetText() + "&sfz="
//                        + sfz.GetText() + "&btbl=" + btbl.GetText() + "&khyh=" + khyh.GetText() + "&btrq=" + btrq.GetText();
                        + "&type=ZJGSXBT";
                        break;
                    }
            }
        }

        //查询
        function search() {
            
            
            window.location.href = rootPath + "/Admin/Fwmmszbtz/FwmmszbtzList?yyyy="
                        + yyyy.GetText() + "&mm=" + mm.GetText() + "&nsr=" + nsr.GetText() + "&sfz="
                        + sfz.GetText() + "&btbl=" + btbl.GetText() + "&khyh=" + khyh.GetText() + "&btrq=" + btrq.GetText();
         }
         //重置
         function undo() {
             ASPxClientTextBox.Cast("yyyy").SetText("");
             ASPxClientTextBox.Cast("mm").SetText("");
             ASPxClientTextBox.Cast("nsr").SetText("");
             ASPxClientTextBox.Cast("sfz").SetText("");
             ASPxClientTextBox.Cast("btbl").SetText("");
             ASPxClientComboBox.Cast("khyh").SetValue("");
             ASPxClientTextBox.Cast("btrq").SetText("");
         
          }

        function fwmmszbtzEdit(id) {
            var rs = window.showModalDialog(rootPath + "/Admin/Fwmmszbtz/FwmmszbtzContent?id=" + id, 'fwmmszbtzEdit', 'dialogWidth:650px;dialogHeight:700px');
            if (typeof (rs) != "undefined") {
                window.location.href = rootPath + "/Admin/Fwmmszbtz/FwmmszbtzList";
            }

        }

        function fwmmszbtzDel(id) {
            if (confirm("确定删除")) {
                $.ajax({
                    type: 'POST',
                    url: rootPath + '/Admin/Fwmmszbtz/Delete',
                    data: { id: id },
                    success: function (result) {
                        if (result == "ok") {
                            alert("删除成功!");
                            gvEditing.Refresh();
                        } else if (result == "error") {
                            alert("删除失败!");
                        } else {
                            alert("删除参数错误!");
                        }
                    }
                });

            }

        }

        //批量删除
        function fwmmszbtzManyDel() {
            var ids = gvEditing.GetSelectedKeysOnPage();
            if (ids.length == 0) {
                alert("请选择要删除的数据");
            } else {
                if (confirm("确定删除")) {
                    var idArray = "";
                    for (var i = 0; i < ids.length; i++) {
                        idArray += ids[i] + "%!^";
                    }

                    $.ajax({
                        type: 'POST',
                        url: rootPath + '/Admin/Fwmmszbtz/DeleteMany',
                        data: { ids: idArray },
                        success: function (result) {
                            if (result == "ok") {
                                alert("删除成功!");
                                gvEditing.Refresh();
                            } else if (result == "error") {
                                alert("删除失败!");
                            } else {
                                alert("删除参数错误!");
                            }
                        }
                    });

                }

            }
        }

    </script>

</head>

<body>
    <div>
        @Html.DevExpress().Menu(settings => 
        {
            settings.Name = "toolBarMenu";
            settings.ItemAutoWidth = false;
            settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
            settings.Styles.Style.Border.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(0);
            settings.Styles.Style.BorderTop.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(1);

            settings.Items.Add(item =>
            {
                item.Name = "btnAdd";
                item.Text = "增加";
                item.ClientEnabled = true;
                item.Image.Url = Url.Content("~/Content/ControlImages/edit_add.png");

            });
            settings.Items.Add(item =>
            {
                item.Name = "btnDelete";
                item.Text = "删除";
                item.ItemStyle.ForeColor = System.Drawing.Color.Red;
                item.ClientEnabled = true;
                item.Image.Url = Url.Content("~/Content/ControlImages/cancel.png");

            });

            settings.Items.Add(item =>
            {
                item.Name = "btnPrint";
                item.Text = "打印";
                item.ClientEnabled = true;
                item.Image.Url = Url.Content("~/Content/ControlImages/print.png");

            });
           
            
            settings.ClientSideEvents.ItemClick = "function(source,e){MenuTop_emClick(source,e)}";
            settings.ItemLinkMode = ItemLinkMode.ContentBounds;
        }).GetHtml()
    </div>
    <table width="100%" class="tableForm">
        <tr>
           <td font-size="14pt" class="tdClass" align="right">年份:</td>
           <td class="tdClass">
                @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "yyyy";
                   settings.Width = System.Web.UI.WebControls.Unit.Pixel(80);
                   
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
           </td>
           <td font-size="14pt" class="tdClass" align="right">@Html.DevExpress().Label(settings => { settings.Text = "月份:"; }).GetHtml()</td>
           <td class="tdClass">
                @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "mm";
                   settings.Width = System.Web.UI.WebControls.Unit.Pixel(80);
                   
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
           </td>
           <td font-size="14pt" class="tdClass" align="right">@Html.DevExpress().Label(settings => { settings.Text = "纳税人:"; }).GetHtml()</td>
           <td class="tdClass">
                @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "nsr";
                   settings.Width = System.Web.UI.WebControls.Unit.Pixel(100);
                   
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
           </td>
            <td font-size="14pt" class="tdClass" align="right">@Html.DevExpress().Label(settings => { settings.Text = "身份证:"; }).GetHtml()</td>
           <td class="tdClass">
                @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "sfz";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
                   
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
           </td>      
        </tr>
        <tr>
            <td font-size="14pt" class="tdClass" align="right">@Html.DevExpress().Label(settings => { settings.Text = "补贴比例:"; }).GetHtml()</td>
           <td class="tdClass">
                @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "btbl";
                   settings.Width = System.Web.UI.WebControls.Unit.Pixel(80);
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
              
           </td>            
           <td font-size="14pt" class="tdClass" align="right">@Html.DevExpress().Label(settings => { settings.Text = "银行:"; }).GetHtml()</td>
        <td class="tdClass">
            @Html.DevExpress().ComboBox(settings =>
               {
                   settings.Name = "khyh";
                   settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
                   settings.Width = System.Web.UI.WebControls.Unit.Pixel(80);
                   settings.Properties.TextField = "Text";
                   settings.Properties.ValueField = "Value";
               }).BindList(new List<SelectListItem> 
                        { 
                            new SelectListItem { Text = "鄞州银行", Value = "鄞州银行" }, 
                            new SelectListItem { Text = "农行", Value = "农行" }
               }).GetHtml()
               </td> 
               
                <td font-size="14pt" class="tdClass" align="right">@Html.DevExpress().Label(settings => { settings.Text = "补贴日期:"; }).GetHtml()</td>
           <td class="tdClass">
                @Html.DevExpress().DateEdit(settings =>
               {
                   settings.Name = "btrq";
                   settings.Width = System.Web.UI.WebControls.Unit.Pixel(100);
                   settings.Properties.DisplayFormatString = "yyyy-MM-dd";
                   settings.Properties.EditFormatString = "yyyy-MM-dd";
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
           </td> 
           <td></td>
           <td class="tdClass">
           @Html.DevExpress().Button(settings =>
            {
                settings.Name = "btnSearch";
                settings.Text = "查询";
                settings.ControlStyle.CssClass = "button";
                settings.Images.Image.Url = Url.Content("~/Content/ControlImages/search.png");
                settings.ClientSideEvents.Click = "search";
            }).GetHtml()

             @Html.DevExpress().Button(settings =>
            {
                settings.Name = "btnUndo";
                settings.Text = "重置";
                settings.ControlStyle.CssClass = "button";
                settings.Images.Image.Url = Url.Content("~/Content/ControlImages/undo_blue.png");
                settings.ClientSideEvents.Click = "undo";
            }).GetHtml()

           </td>              
        </tr>
    </table>
        @Html.Partial("FwmmszbtzListPartial", Model)

        @Html.Hidden("hidszbtzNo", ViewData["szbtzNo"])
        @Html.Hidden("hidyyyy", ViewData["yyyy"])
        @Html.Hidden("hidmm", ViewData["mm"])
        @Html.Hidden("hidnsr", ViewData["nsr"])
        @Html.Hidden("hidsfz", ViewData["sfz"])
        @Html.Hidden("hidbtbl", ViewData["btbl"])
        @Html.Hidden("hidkhyh", ViewData["khyh"])
        @Html.Hidden("hidbtrq", ViewData["btrq"])
     <script>
         lp.Hide();
    </script>
</body>
</html>
